package util;

import java.awt.Image;
import javax.swing.ImageIcon;

/**
 * This class is responsible for getting an image from a spefic path.
 * @author Christian, Michal og Jakob (Hold 1, gruppe 2)
 */
public class ImageGetter {
    
    /**
     * Gets the image at the specified path.
     * This method gets the image using ImageIcon at the specified path. 
     * Thus the image is loaded immediatly since ImageIcon has a MediaTracker functionality built in.
     * @param s the path to the image
     * @return file as an Image
     */
    
    public static Image getImage(String s)
    {
        String pathToImage = FileGetter.getPathToFile(s);
        ImageIcon imageicon = new ImageIcon(pathToImage);
        Image returnedImage = imageicon.getImage();
        assert returnedImage != null : "ImageGetter: Image == null, could not get Image";
        return returnedImage;
        
    }

}
